import React from 'react'
// import { useState } from "react"

export interface User {
  name: string,
  gender: number,
  id: number
  token: string
}

interface SearchPanelProps {
  users: User[],
  param: {
    name: string,
    personId: string
  },
  setParam: (param: SearchPanelProps['param']) => void
}

export const SearchPanel = ({users, param, setParam}:SearchPanelProps) => {

  return <form>
    <input type="text" value={param?.name} onChange={evt => setParam({
      ...param,
      name: evt.target.value
    })} />
    <select value={param?.personId} onChange={evt => setParam({
      ...param,
      personId: evt.target.value
    })}>
      <option value={''}>负责人</option>
      {
        users && users.map((user:any, index:number) => <option key={index} value={user?.id}>{user.name}</option>)
      }
    </select>
  </form>
}